//
//  HHTabBarController.m
//  百思不得姐
//
//  Created by hjl on 16/4/11.
//  Copyright © 2016年 hjl. All rights reserved.
//

#import "HHTabBarController.h"
#import "HHNavigationController.h"
#import "HHTabBar.h"
#import "HHNewViewController.h"
#import "HHEssenceViewController.h"
#import "HHMeViewController.h"
#import "HHFriendViewController.h"
@interface HHTabBarController ()

@end

@implementation HHTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    HHTabBar *tabBar = [[HHTabBar alloc] init];
   
    [self setValue:tabBar forKey:@"tabBar"];
    
    self.tabBar.tintColor = HHRGBColor(50, 50, 50, 1.0);
    
    [self addChildVc:[[HHEssenceViewController alloc] init] title:@"精华" image:@"tabBar_essence_icon" selectedImage:@"tabBar_essence_click_icon"];
    
    [self addChildVc:[[HHNewViewController alloc] init] title:@"最新" image:@"tabBar_new_icon" selectedImage:@"tabBar_new_click_icon"];
    
    [self addChildVc:[[HHFriendViewController alloc] init] title:@"关注" image:@"tabBar_friendTrends_icon" selectedImage:@"tabBar_friendTrends_click_icon"];
    
    [self addChildVc:[[HHMeViewController alloc] init] title:@"我" image:@"tabBar_me_icon" selectedImage:@"tabBar_me_click_icon"];
    
}


- (void)addChildVc:(UIViewController *)vc title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage{
    
    vc.tabBarItem.title = title;
    [vc.tabBarItem setImage:[UIImage imageNamed:image]];
    [vc.tabBarItem setSelectedImage:[UIImage imageNamed:selectedImage]];
    HHNavigationController *nav = [[HHNavigationController alloc] initWithRootViewController:vc];
    [self addChildViewController:nav];
}


@end
